//打开评论输入框
function openPinglun() {
    //是否打开评论
    let isOpen = {
        state: false,
        page: 0
    };
    if (textContains("发条有爱评论~").exists() && click("发条有爱评论~")) {
        isOpen.state = true
    } else {
        click(1135, 1769)
        sleep(1000)
        if (textContains("发条有爱评论~").exists() && click("发条有爱评论~")) {
            isOpen.state = true
            isOpen.page = 1
        } else if (textContains("快来抢首评吧").exists() && click("快来抢首评吧")) {
            isOpen.state = true
            isOpen.page = 1
        }
    }
    sleep(1500)
    return isOpen;
}


//发送评论
function sendPinglun(text) {
    //发送状态
    let sendState = false;
    let isOpen = openPinglun()
    if (isOpen.state) {
        setText(text)    //输入评论
        sleep(2000)
        if (click("发送")) {      //发送评论
            sleep(1000)
            if (isOpen.page > 0) {
                back()
            }
            sendState = true;
        }
    }
    return sendState;
}

sendPinglun("帅帅帅！");